

package cn.iocoder.yudao.module.apijson.framework;

import apijson.NotNull;
import apijson.RequestMethod;
import apijson.orm.AbstractObjectParser;
import apijson.orm.Join;
import apijson.orm.Parser;
import apijson.orm.SQLConfig;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.util.List;


/**
 * 简化Parser，getObject和getArray(getArrayConfig)都能用
 *
 * @author Lemon
 */
public class APIJSONObjectParser extends AbstractObjectParser<Long, JSONObject, JSONArray> {
    public static final String TAG = "APIJSONObjectParser";

    /**
     * for single object
     */
    public APIJSONObjectParser(@NotNull JSONObject request, String parentPath, SQLConfig<Long, JSONObject, JSONArray> arrayConfig
            , boolean isSubquery, boolean isTable, boolean isArrayMainTable) throws Exception {
        super(request, parentPath, arrayConfig, isSubquery, isTable, isArrayMainTable);
    }

    @Override
    public APIJSONObjectParser setMethod(RequestMethod method) {
        super.setMethod(method);
        return this;
    }

    @Override
    public APIJSONObjectParser setParser(Parser<Long, JSONObject, JSONArray> parser) {
        super.setParser(parser);
        return this;
    }


    @Override
    public SQLConfig<Long, JSONObject, JSONArray> newSQLConfig(RequestMethod method, String table, String alias, JSONObject request
            , List<Join<Long, JSONObject, JSONArray>> joinList, boolean isProcedure) throws Exception {
        return APIJSONSQLConfig.newSQLConfig(method, table, alias, request, joinList, isProcedure);
    }

}
